import request from '@/utils/request'

export function getPostData(userId, categoryId, isDescending, PostCurrentPage, PostPageSize) {
    return request({
        url: '/publish/post?userId=' + userId + '&categoryId=' + categoryId + '&isDescending=' + isDescending + '&PostCurrentPage=' + PostCurrentPage + '&PostPageSize=' + PostPageSize,
        method: 'get'
    })
}

export function getPostHotData() {
    return request({
        url: '/publish/hot',
        method: 'get'
    })
}

export function getPostInfoById(postId) {
    return request({
        url: '/post/id?postId=' + postId,
        method: 'get'
    })
}

export function getAuthorDataByPostId(postId) {
    return request({
        url: '/post/user?postId=' + postId,
        method: 'get'
    })
}

export function getIsFollow(userId, followId) {
    return request({
        url: '/is/follow?userId=' + userId + '&followId=' + followId,
        method: 'get'
    })
}

export function cancelFollow(userId, followId) {
    return request({
        url: '/cancel/follow?userId=' + userId + '&followId=' + followId,
        method: 'post'
    })
}

export function Follow(userId, followId) {
    return request({
        url: '/active/follow?userId=' + userId + '&followId=' + followId,
        method: 'post'
    })
}

export function judgeLikes(userId, postId) {
    return request({
        url: '/is/like?userId=' + userId + '&postId=' + postId,
        method: 'get'
    })
}

export function activeLikes(userId, postId) {
    return request({
        url: '/active/like?userId=' + userId + '&postId=' + postId,
        method: 'post'
    })
}

export function cancelLikes(userId, postId) {
    return request({
        url: '/cancel/like?userId=' + userId + '&postId=' + postId,
        method: 'post'
    })
}

export function getLikeCount(postId) {
    return request({
        url: '/like/count?postId=' + postId,
        method: 'get'
    })
}

export function judgeCollect(userId, postId) {
    return request({
        url: '/is/collect?userId=' + userId + '&postId=' + postId,
        method: 'get'
    })
}

export function activeCollect(userId, postId, categoryId) {
    return request({
        url: '/active/collect?userId=' + userId + '&postId=' + postId + '&categoryId=' + categoryId,
        method: 'post'
    })
}

export function cancelCollect(userId, postId, categoryId) {
    return request({
        url: '/cancel/collect?userId=' + userId + '&postId=' + postId + '&categoryId=' + categoryId,
        method: 'post'
    })
}

export function getCollectCount(postId) {
    return request({
        url: '/collect/count?postId=' + postId,
        method: 'get'
    })
}

export function getCollectCategory(userId) {
    return request({
        url: '/collect/category?userId=' + userId,
        method: 'get'
    })
}

export function createCategory(data) {
    return request({
        url: '/create/collect/category',
        method: 'post',
        data: data

    })
}

export function addPostPageView(postId) {
    return request({
        url: '/add/post/page/view?postId=' + postId,
        method: 'put'
    })
}